package edu.xlh.travel.aipay.alipay;

import edu.xlh.travel.service.CallBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/alipay")
public class CallBackController {
    @Autowired
    private CallBackService callBackService;

    @RequestMapping(value = "/alipayReturnNotice")
    public String alipayReturnNotice(HttpServletRequest request, ModelMap model) throws Exception {
        return callBackService.alipayReturnNotice(request , model);
    }

    @RequestMapping(value = "/alipayNotifyNotice")
    @ResponseBody
    public String alipayNotifyNotice(HttpServletRequest request) throws Exception {
        return callBackService.alipayNotifyNotice(request);
    }

    @RequestMapping("/index")
    public String toIndext() {
        return "page/index";
    }
}
